home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / opdesc.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  8KB  |  300 lines

  1. /*
  2.  * Copyright (C) 1985-1992  New York University
  3.  * 
  4.  * This file is part of the Ada/Ed-C system.  See the Ada/Ed README file for
  5.  * warranty (none) and distribution info and also the GNU General Public
  6.  * License for more details.
  7.  
  8.  */
  9.  
  10. #define GEN
  11.  
  12. #include "hdr.h"
  13. #include "vars.h"
  14. #include "gvars.h"
  15. #include "opdescp.h"
  16.  
  17. int opdesc_d_mode,opdesc_a_mode;
  18. char *opdesc_name;
  19.  
  20. #ifdef OPDESC_TEST
  21. /* define OPDESC_TEST for standalone test of opdesc*/
  22. main()
  23. {
  24.     opdesc(260);
  25.     printf("%d %d %s\n",opdesc_d_mode, opdesc_a_mode, opdesc_name);
  26. }
  27. #endif
  28.  
  29. void opdesc(int op)                /*;opdesc*/
  30. {
  31.     /* return paramters of opcode, as globals opdesc_d_mode, 
  32.      * opdesc_a_mode, opdesc_name
  33.      */
  34.  
  35.     static struct opdesc_ent {
  36.         short op_d_mode, op_a_mode;
  37.         char *op_name;
  38.     } opara[] = {
  39.         {  D_NONE, A_NONE, "nop"},
  40.         {  D_NONE, A_IMM, "abort"},
  41.         {  D_FIX, A_NONE, "abs"},
  42.         {   0, 0, "" }, 
  43.         {   0, 0, "" }, 
  44.         {   0, 0, "" }, 
  45.         {  D_NONE, A_NONE, "activate"},
  46.         {  D_NONE, A_BOTH, "activate_new"},
  47.         {   0, 0, "" }, 
  48.         {  D_FIX, A_NONE, "add"},
  49.         {   0, 0, "" }, 
  50.         {   0, 0, "" }, 
  51.         {   0, 0, "" }, 
  52.         {  D_FIX, A_IMM, "add_immediate"},
  53.         {   0, 0, "" }, 
  54.         {   0, 0, "" }, 
  55.         {   0, 0, "" }, 
  56.         {  D_NONE, A_NONE, "and"},
  57.         {  D_NONE, A_NONE, "allocate"},
  58.         {  D_NONE, A_BOTH, "allocate_copy"},
  59.         {   0, 0, "" }, 
  60.         {  D_NONE, A_NONE, "array_and"},
  61.         {  D_NONE, A_NONE, "array_catenate"},
  62.         {  D_NONE, A_NONE, "array_move"},
  63.         {  D_NONE, A_NONE, "array_not"},
  64.         {  D_NONE, A_NONE, "array_or"},
  65.         {  D_NONE, A_NONE, "array_slice"},
  66.         {  D_NONE, A_NONE, "array_xor"},
  67.         {  D_NONE, A_ATTR, "attribute"},
  68.         {  D_NONE, A_BOTH, "call"},
  69.         {   0, 0, "" }, 
  70.         {  D_NONE, A_PREDEF, "call_predef"},
  71.         {  D_INT, A_NONE, "case"},
  72.         {   0, 0, "" }, 
  73.         {   0, 0, "" }, 
  74.         {  D_ALL, A_NONE, "compare"},
  75.         {   0, 0, "" }, 
  76.         {   0, 0, "" }, 
  77.         {   0, 0, "" }, 
  78.         {   0, 0, "" }, 
  79.         {   0, 0, "" }, 
  80.         {  D_NONE, A_NONE, "compare_struc"},
  81.         {  D_NONE, A_BOTH, "convert_to"},
  82.         {   0, 0, "" }, 
  83.         {  D_ALL, A_NONE, "create"},
  84.         {   0, 0, "" }, 
  85.         {   0, 0, "" }, 
  86.         {   0, 0, "" }, 
  87.         {   0, 0, "" }, 
  88.         {   0, 0, "" }, 
  89.         {  D_ALL, A_NONE, "create_copy"},
  90.         {   0, 0, "" }, 
  91.         {   0, 0, "" }, 
  92.         {   0, 0, "" }, 
  93.         {   0, 0, "" }, 
  94.         {   0, 0, "" }, 
  95.         {  D_NONE, A_NONE, "create_copy_struc"},
  96.         {  D_NONE, A_BOTH, "create_task"},
  97.         {   0, 0, "" }, 
  98.         {  D_NONE, A_NONE, "create_struc"},
  99.         {  D_NONE, A_NONE, "current_task"},
  100.         {  D_NONE, A_NONE, "deallocate"},
  101.         {  D_ALL, A_LOCAL, "declare"},
  102.         {   0, 0, "" }, 
  103.         {   0, 0, "" }, 
  104.         {   0, 0, "" }, 
  105.         {   0, 0, "" }, 
  106.         {   0, 0, "" }, 
  107.         {  D_ALL, A_NONE, "deref"},
  108.         {   0, 0, "" }, 
  109.         {   0, 0, "" }, 
  110.         {   0, 0, "" }, 
  111.         {   0, 0, "" }, 
  112.         {   0, 0, "" }, 
  113.         {  D_NONE, A_IMM, "discard_addr"},
  114.         {  D_INT, A_NONE, "div"},
  115.         {   0, 0, "" }, 
  116.         {   0, 0, "" }, 
  117.         {  D_ALL, A_NONE, "duplicate"},
  118.         {   0, 0, "" }, 
  119.         {   0, 0, "" }, 
  120.         {   0, 0, "" }, 
  121.         {   0, 0, "" }, 
  122.         {   0, 0, "" }, 
  123.         {  D_NONE, A_IMM, "end_activation"},
  124.         {  D_INT, A_CODE, "end_for_loop"},
  125.         {   0, 0, "" }, 
  126.         {   0, 0, "" }, 
  127.         {  D_INT, A_CODE, "end_forrev_loop"},
  128.         {   0, 0, "" }, 
  129.         {   0, 0, "" }, 
  130.         {  D_NONE, A_NONE, "end_rendezvous"},
  131.         {  D_NONE, A_NONE, "enter_block"},
  132.         {  D_NONE, A_IMM, "entry_call"},
  133.         {  D_NONE, A_NONE, "fix_mul"},
  134.         {  D_NONE, A_NONE, "fix_div"},
  135.         {  D_FLOAT, A_NONE, "float_add"},
  136.         {   0, 0, "" }, 
  137.         {  D_FLOAT, A_NONE, "float_compare"},
  138.         {   0, 0, "" }, 
  139.         {  D_FLOAT, A_NONE, "float_div"},
  140.         {   0, 0, "" }, 
  141.         {  D_FLOAT, A_NONE, "float_mul"},
  142.         {   0, 0, "" }, 
  143.         {  D_FLOAT, A_NONE, "float_neg"},
  144.         {   0, 0, "" }, 
  145.         {  D_FLOAT, A_NONE, "float_pow"},
  146.         {   0, 0, "" }, 
  147.         {  D_FLOAT, A_NONE, "float_sub"},
  148.         {   0, 0, "" }, 
  149.         {  D_FLOAT, A_NONE, "float_abs"},
  150.         {   0, 0, "" }, 
  151.         {  D_ALL, A_NONE, "indirect_move"},
  152.         {   0, 0, "" }, 
  153.         {   0, 0, "" }, 
  154.         {   0, 0, "" }, 
  155.         {   0, 0, "" }, 
  156.         {   0, 0, "" }, 
  157.         {  D_ALL, A_BOTH, "indirect_pop"},
  158.         {   0, 0, "" }, 
  159.         {   0, 0, "" }, 
  160.         {   0, 0, "" }, 
  161.         {   0, 0, "" }, 
  162.         {   0, 0, "" }, 
  163.         {   0, 0, "" }, 
  164.         {   0, 0, "" }, 
  165.         {   0, 0, "" }, 
  166.         {   0, 0, "" }, 
  167.         {   0, 0, "" }, 
  168.         {   0, 0, "" }, 
  169.         {  D_NONE, A_CODE, "install_handler"},
  170.         {  D_NONE, A_NONE, "is_equal"},
  171.         {  D_NONE, A_NONE, "is_less"},
  172.         {  D_NONE, A_NONE, "is_greater"},
  173.         {  D_NONE, A_NONE, "is_less_or_equal"},
  174.         {  D_NONE, A_NONE, "is_greater_or_equal"},
  175.         {  D_NONE, A_CODE, "jump"},
  176.         {  D_NONE, A_CODE, "jump_if_false"},
  177.         {  D_NONE, A_CODE, "jump_if_greater"},
  178.         {  D_NONE, A_CODE, "jump_if_greater_or_equal"},
  179.         {  D_NONE, A_CODE, "jump_if_less"},
  180.         {  D_NONE, A_CODE, "jump_if_less_or_equal"},
  181.         {  D_NONE, A_CODE, "jump_if_true"},
  182.         {  D_NONE, A_NONE, "leave_block"},
  183.         {  D_NONE, A_NONE, "link_tasks_declared"},
  184.         {  D_NONE, A_EXCEPTION, "load_exception_register"},
  185.         {  D_NONE, A_NONE, "membership"},
  186.         {  D_INT, A_NONE, "mod"},
  187.         {   0, 0, "" }, 
  188.         {   0, 0, "" }, 
  189.         {  D_ALL, A_NONE, "move"},
  190.         {   0, 0, "" }, 
  191.         {   0, 0, "" }, 
  192.         {   0, 0, "" }, 
  193.         {   0, 0, "" }, 
  194.         {   0, 0, "" }, 
  195.         {  D_INT, A_NONE, "mul"},
  196.         {   0, 0, "" }, 
  197.         {   0, 0, "" }, 
  198.         {  D_FIX, A_NONE, "neg"},
  199.         {   0, 0, "" }, 
  200.         {   0, 0, "" }, 
  201.         {   0, 0, "" }, 
  202.         {  D_NONE, A_NONE, "not"},
  203.         {  D_NONE, A_NONE, "or"},
  204.         {  D_ALL, A_BOTH, "pop"},
  205.         {   0, 0, "" }, 
  206.         {   0, 0, "" }, 
  207.         {   0, 0, "" }, 
  208.         {   0, 0, "" }, 
  209.         {   0, 0, "" }, 
  210.         {   0, 0, "" }, 
  211.         {   0, 0, "" }, 
  212.         {   0, 0, "" }, 
  213.         {   0, 0, "" }, 
  214.         {   0, 0, "" }, 
  215.         {   0, 0, "" }, 
  216.         {  D_NONE, A_BOTH, "pop_tasks_declared"},
  217.         {   0, 0, "" }, 
  218.         {  D_INT, A_NONE, "pow"},
  219.         {   0, 0, "" }, 
  220.         {   0, 0, "" }, 
  221.         {  D_ALL, A_BOTH, "push"},
  222.         {   0, 0, "" }, 
  223.         {   0, 0, "" }, 
  224.         {   0, 0, "" }, 
  225.         {   0, 0, "" }, 
  226.         {   0, 0, "" }, 
  227.         {   0, 0, "" }, 
  228.         {   0, 0, "" }, 
  229.         {   0, 0, "" }, 
  230.         {   0, 0, "" }, 
  231.         {   0, 0, "" }, 
  232.         {   0, 0, "" }, 
  233.         {  D_NONE, A_BOTH, "push_effective_address"},
  234.         {   0, 0, "" }, 
  235.         {  D_ALL, A_IMM, "push_immediate"},
  236.         {   0, 0, "" }, 
  237.         {   0, 0, "" }, 
  238.         {   0, 0, "" }, 
  239.         {   0, 0, "" }, 
  240.         {   0, 0, "" }, 
  241.         {  D_NONE, A_BOTH, "qual_discr"},
  242.         {   0, 0, "" }, 
  243.         {  D_NONE, A_BOTH, "qual_index"},
  244.         {   0, 0, "" }, 
  245.         {  D_NONE, A_BOTH, "qual_range"},
  246.         {   0, 0, "" }, 
  247.         {  D_NONE, A_BOTH, "qual_sub"},
  248.         {   0, 0, "" }, 
  249.         {  D_NONE, A_NONE, "raise"},
  250.         {  D_NONE, A_NONE, "raise_in_caller"},
  251.         {  D_NONE, A_BOTH, "record_move"},
  252.         {   0, 0, "" }, 
  253.         {  D_INT, A_NONE, "rem"},
  254.         {   0, 0, "" }, 
  255.         {   0, 0, "" }, 
  256.         {  D_NONE, A_LOCAL, "restore_stack_pointer"},
  257.         {  D_ALL, A_LOCAL, "return"},
  258.         {   0, 0, "" }, 
  259.         {   0, 0, "" }, 
  260.         {   0, 0, "" }, 
  261.         {   0, 0, "" }, 
  262.         {   0, 0, "" }, 
  263.         {  D_NONE, A_LOCAL, "return_struc"},
  264.         {  D_NONE, A_LOCAL, "save_stack_pointer"},
  265.         {  D_NONE, A_IMM, "select"},
  266.         {  D_NONE, A_IMM, "selective_wait"},
  267.         {  D_NONE, A_NONE, "compare_arrays"},
  268.         {  D_NONE, A_IMM, "stmt"},
  269.         {  D_FIX, A_NONE, "sub"},
  270.         {   0, 0, "" }, 
  271.         {   0, 0, "" }, 
  272.         {   0, 0, "" }, 
  273.         {  D_NONE, A_LOCAL, "subprogram"},
  274.         {  D_NONE, A_NONE, "subscript"},
  275.         {  D_NONE, A_IMM, "terminate"},
  276.         {  D_NONE, A_EXCEPTION, "test_exception_register"},
  277.         {  D_NONE, A_IMM, "timed_entry_call"},
  278.         {  D_NONE, A_GLOBAL, "type_global"},
  279.         {  D_NONE, A_GLOBAL, "type_local"},
  280.         {  D_NONE, A_NONE, "uncreate"},
  281.         {  D_NONE, A_LOCAL, "update"},
  282.         {  D_NONE, A_LOCAL, "update_and_discard"},
  283.         {  D_NONE, A_NONE, "wait"},
  284.         {  D_NONE, A_NONE, "xor"},
  285.         {  D_NONE, A_NONE, "exit_block"},
  286.         {  D_NONE, A_IMM, "call_interface"},
  287.         {  D_NONE, A_NONE, "check_rec_subtype"},
  288.         {  D_PSEUDO, A_PSEUDO, "case_table"},
  289.         {  D_PSEUDO, A_PSEUDO, "label"},
  290.         {   0, 0, "" }, 
  291.         {  D_PSEUDO, A_PSEUDO, "end"},
  292.         {  D_PSEUDO, A_PSEUDO, "data"},
  293.         {   0, 0, "" } 
  294.     };
  295.  
  296.     opdesc_d_mode = opara[op].op_d_mode;
  297.     opdesc_a_mode = opara[op].op_a_mode;
  298.     opdesc_name = opara[op].op_name;
  299. }
  300.